<template>
  <div class="color">
    <div class="color__title">{{ title }}</div>

    <div class="color__list">
      <div class="color__list__item" v-for="c in colors" :key="c">
        <div class="color__variable"><div class="color__label">变量:</div> {{ c }}</div>
        <div class="color__card" :style="{background: `var(${c})`}"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ColorItem',
  props: {
    title: {
      type: String,
      default: ''
    },
    colors: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {

    }
  }
}
</script>

<style lang="scss" scoped>
.color {
  color: var(--color-text-primary);

  &__title {
    font-size: 20px;
    padding: 10px 0;
  }

  &__list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    &__item {
      min-width: 250px;
      margin-bottom: 10px;
    }
  }

  &__variable {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
  }

  &__label {
    font-size: 14px;
    margin-right: 5px;
    color: var(--color-text-secondary);
  }

  &__card {
    width: 200px;
    height: 60px;
    border-radius: 10px;
  }
}
</style>
